import request from '@/utils/request'
import type { ApiResponse } from '../index'
import type { Post, PostResponse, PostComment } from '@/types/post'

// 文章相关接口
export const postApi = {
  // 获取所有文章
  getList() {
    return request.get<ApiResponse<PostResponse['data']>>('/public/posts')
  },
  
  // 获取文章详情
  getDetail(id: number) {
    return request.get<ApiResponse<Post>>(`/public/posts/${id}`)
  },
  
  // 获取文章评论
  getComments(postId: number) {
    return request.get<ApiResponse<PostComment[]>>(`/public/posts/${postId}/comments`)
  }
} 